package cn.com.xf.dao.impl;

import cn.com.xf.dao.TblRegExpressDAO;
import cn.com.xf.dao.support.XFSqlMapClientDaoSupport;
import cn.com.xf.domain.TblRegExpress;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

@Repository
public class TblRegExpressDAOImpl extends XFSqlMapClientDaoSupport implements TblRegExpressDAO {

   
    public TblRegExpressDAOImpl() {
        super();
    }

	@Override
	public TblRegExpress selectById(Integer id) {		
		return (TblRegExpress) getSqlMapClientTemplate().queryForObject("TBL_REG_EXPRESS.selectById",id);
	}

	

	@Override
	public void deleteById(Integer id) {
		getSqlMapClientTemplate().update("TBL_REG_EXPRESS.deleteById",id);
		
	}

	@Override
	public int update(TblRegExpress tre) {
		return getSqlMapClientTemplate().update("TBL_REG_EXPRESS.update",tre);
	}

	@Override
	public void insert(TblRegExpress tre) {
		getSqlMapClientTemplate().insert("TBL_REG_EXPRESS.insert",tre);
	}

	@Override
	public int selectCount(String username, String exnum,String addtimeStart,String addtimeEnd) {
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("addtimeStart", addtimeStart);
		map.put("addtimeEnd", addtimeEnd);
		map.put("username", username);
		map.put("exnum", exnum);
		int count = (Integer)getSqlMapClientTemplate().queryForObject("TBL_REG_EXPRESS.selectCount",map);
		return count;
	}

	@Override
	public List<TblRegExpress> selectRegExpress(int begin, int pageSize, String orderByField, String orderByMode,
			String username, String exnum,String addtimeStart,String addtimeEnd) {
		Map<String, Object> map = new HashMap<String, Object>();
		int end = begin + pageSize;
		begin = begin + 1;
		map.put("begin", begin);
		map.put("end", end);
		map.put("orderByField", orderByField);
		map.put("orderByMode", orderByMode);
		map.put("addtimeStart", addtimeStart);
		map.put("addtimeEnd", addtimeEnd);
		map.put("username", username);
		map.put("exnum", exnum);
		List<TblRegExpress> list =  getSqlMapClientTemplate().queryForList("TBL_REG_EXPRESS.selectRegExpress",map);
		return list;
	}

	@Override
	public int select30DayCount(String exnum) {
		return (Integer)getSqlMapClientTemplate().queryForObject("TBL_REG_EXPRESS.select30DayCount",exnum);
	}

    
}